import type from "./action-type";
import { combineReducers } from "redux";

const reducer = {};

reducer.username = (state = "", action = {}) => {
  const { payload } = action;

  switch (action.type) {
    case type.SET_USERNAME:
      return payload;
    default:
      return state;
  }
};

reducer.token = (state = "", action = {}) => {
  const { payload } = action;

  switch (action.type) {
    case type.SET_TOKEN:
      return payload;
    default:
      return state;
  }
};

export default combineReducers({ ...reducer });
